// pages/personal-information.js
// 获取全局应用程序实例对象
const app = getApp()

Page({

  /**
   * 页面的初始数据
   */
  data: {
    money: 0,
    pic: '',
    phone: '',
    province: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var params={
      openid: app.globalData.info.openid
    };
    var that=this;
    app.network.POST(
      'https://www.ausck.com/api/vip_info',
      {
        params: params,
        success: function (res) {
          console.log(res.data)
          //拿到解密后的数据，进行代码逻辑
            that.setData({
              money: parseInt(res.data.data.money) || 0,
              pic: res.data.data.pic || '',
              phone: res.data.data.phone ||'',
              province: res.data.data.province || ''
            })
            getApp().globalData.personalInfo=res.data.data;
        },
        fail: function () {
          //失败后的逻辑  
        },
      })
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  toBalance:function(){
    wx.navigateTo({
      url: "/pages/balance/balance"
    })
  },
  toMemberInformation:function(){
    wx.navigateTo({
      url: "/pages/member-information/member-information"
    })
  },
  toMyorder: function (e) {
    wx.navigateTo({
      url: "/pages/myorder/myorder?id=" + e.currentTarget.dataset.id
    })
  },
  toRecharge: function () {
    wx.navigateTo({
      url: "/pages/recharge/recharge"
    })
  },
  toCustomerService: function () {
    wx.navigateTo({
      url: "/pages/customer-service/customer-service?index=1"
    })
  },

})

